﻿<!DOCTYPE html>

<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8" />
    <link href="css/global.css" rel="stylesheet" />
    <link href="css/font-awesome.css" rel="stylesheet" />
    <link href="css/icons.css" rel="stylesheet" />
    <script src="js/jquery.min.js"></script>
    <script src="js/common.js"></script>
    <title></title>
</head>
<body>
    <div class="header">
        <div class="bar"></div>
        <a class="linkbutton fa fa-minus" onclick="minimize();"></a>
        <a class="linkbutton fa fa-square-o" onclick="maximize();"></a>
        <a class="linkbutton fa fa-close" onclick="shutdown();"></a>
    </div>

    自定义页面内容
    <button onclick="callSharpFunc();">点击调用C#代码</button>
    <form id="form">
        <input id="id" name="id" type="text" />
        <input id="txt" name="text" type="text" />
        <input id="name" name="name" type="text" />
    </form>

    <button onclick="postData();">传递json数据</button>
    <button onclick="gotoPage();">切换page2</button>
    <button onclick="callScriptFunc();">调用C#函数</button>
    <script>
        function callSharpFunc() {
            var txt = $("#txt").val();
            var result = window.chrome.webview.hostObjects.sync.testForm.GetMessage(txt);
            var data = JSON.parse(result);
            console.log(data);
        }

        function postData() {
            var data = getFormData("#form", true);
            var result =window.chrome.webview.hostObjects.testForm.GetJsonData(data);
            alert(result);
        }

        function callScriptFunc() {
            window.chrome.webview.hostObjects.testForm.CallScriptFunc();
        }

        function showMessage(data) {
            alert(JSON.stringify(data));
        }

        function gotoPage() {
            window.chrome.webview.hostObjects.testForm.GotoPage("page2.html");
        }
    </script>
</body>
</html>